﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
     <title>节点-方向条件</title>
    <link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>

    <script type="text/javascript">
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            //初始化groupID.
            var nodeID = GetQueryString("FK_MainNode");
            var toNodeID = GetQueryString("ToNodeID");

            var ens = new Entities("BP.WF.Template.Conds");
            ens.Retrieve("NodeID", nodeID, "CondType", 2, "ToNodeID", toNodeID);

            var html = "<table style='width:98%;'>";
            html += "<caption><img src='../../Img/Event.png' />节点- 方向条件</caption>";
            html += "<tr>";
            html += "<th>序</th>";
            html += "<th>标识</th>";
            html += "<th>类型编号</th>";
            html += "<th>类型</th>";
            html += "<th>内容描述</th>";
            html += "<th>操作</th>";
            html += "</tr>";

            for (var i = 0; i < ens.length; i++) {

                var en = ens[i];
                var condDesc = GetCondDesc(en.DataFrom);

                html += "<tr>";
                html += "<td class=Idx>" + (i + 1) + "</td>";
                html += "<td>" + en.MyPK + "</td>";
                html += "<td>" + condDesc.No + "</td>";
                html += "<td><a href=\"javascript:NewCond('" + condDesc.No + "');\">" + condDesc.Name + "</a></td>";

                var docs = "";
                if (condDesc.No == "CondByFrm") {
                    docs += "解读:" + en.AttrName + " " + en.FK_Operator + " " + "" + en.OperatorValueT;
                    docs += "<br>字段:" + en.AttrKey + " " + en.FK_Operator + " " + en.OperatorValue;
                }

                if (condDesc.No == "CondDept" || condDesc.No == "CondStation" ) {
                    docs += "解读:" + en.OperatorValueT;
                    docs += "<br>值:" + en.OperatorValue;
                }

                html += "<td>" + docs + "</td>";

                html += "<td><a href=\"javascript:Delete('" + en.MyPK + "')\"><img src='../../Img/Btn/Delete.gif' border=0 />删除</a></td>";
                html += "</tr>";
            }
            html += "</table>";

            $("#Msg").html(html);
        });


        function Delete(mypk) {

            if (confirm('您确定要删除吗？') == false)
                return;
            var en = new Entity("BP.WF.Template.Cond", mypk);
            en.Delete();
            window.location.href = window.location.href;
            return;
        }
        function GetCondDesc(type) {

            //事件类型.
            var eventLists = [
            { No: "CondByFrm", Name: "按表单条件计算", EnumKey: 0 },
            { No: "StandAloneFrm", Name: "按已选择的独立表单条件计算", EnumKey: 1 },
            { No: "CondStation", Name: "按指定操作员的岗位条件", EnumKey: 2 },
            { No: "CondDept", Name: "按指定操作员的部门条件", EnumKey: 3 },
            { No: "CondBySQL", Name: "按SQL条件计算", EnumKey: 4 },
            { No: "CondBySQLTemplate", Name: "按SQL模版条件计算", EnumKey: 5 },
            { No: "CondByPara", Name: "按开发者参数计算", EnumKey: 6 },
            { No: "CondByUrl", Name: "按Url条件计算", EnumKey: 7 }
            ]

            for (var i = 0; i < eventLists.length; i++) {
                var en = eventLists[i];
                if (en.EnumKey == type)
                    return en;

                    //return en.Name;
            }
            return "xxxx";
        }
       
        function Help() {
            var url = "http://ccbpm.mydoc.io";
            window.open(url);
        }
        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);
            if (ctrl.style.display == "block") {
                ctrl.style.display = 'none';
            } else {
                ctrl.style.display = 'block';
            }
        }
        function NewCond(type) {
            var url = window.location.href;
            url = url.replace('List.htm', type + '.htm');
            window.location.href = url;
        }
    </script>
</head>
<body  >
	<form id="cc">
	 
     <div id="Msg"></div>
     
     <br />
     <input type="button" value="+新建方向条件" onclick="ShowHidden('state')" />

      <div id="state" style="display: none; color: Gray">
                <ul>
                    <li><a href="javascript:NewCond('CondByFrm');">按表单条件计算</a> </li>
                    <li><a href="javascript:NewCond('StandAloneFrm');">按已选择的独立表单条件计算</a> </li>
                    <li><a href="javascript:NewCond('CondStation');">按指定操作员的岗位条件</a></li>
                    <li><a href="javascript:NewCond('CondDept');">按指定操作员的部门条件</a> </li>
                    <li><a href="javascript:NewCond('CondBySQL');">按SQL条件计算</a> </li>
                    <li><a href="javascript:NewCond('CondBySQLTemplate');">按SQL模版条件计算</a> </li>
                    <li><a href="javascript:NewCond('CondByPara');">按开发者参数计算</a> </li>
                    <li><a href="javascript:NewCond('CondByUrl');">按Url条件计算</a> </li>

                </ul>
            </div>

     <input type="button" value="什么是方向条件？"  onclick="javascript:Help()" />


	</form>
</body>
</html>
